<template>
  <div class="vue-lazyload clearfix">
    <el-scrollbar style="height: 100%">
    <div class="main">
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">包引入</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            npm install vue-lazyload --save-dev
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">mian.js引入</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            import VueLazyLoad from 'vue-lazyload'<br>
            Vue.use(VueLazyLoad,{<br>
                &nbsp;&nbsp;// 图片加载错误时显示
                &nbsp;&nbsp;error:'./static/error.png',<br>
                &nbsp;&nbsp;// 图片加载等待时显示
                &nbsp;&nbsp;loading:'./static/loading.png'<br>
            })
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">.vue使用</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            // 将:src换成v-lazy<br>
            &lt;img class="item-pic" v-lazy="newItem.picUrl"/&gt;
          </code>
        </div>
      </el-card>
    </div>
    </el-scrollbar>
  </div>
</template>

<script>
export default {
  name: 'VueLazyload'
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
.vue-lazyload{
  margin: 0 auto;
  overflow: hidden;
  .main{
    column-count: 2;
    column-gap:10px;
    padding: 10px;
  }
  .el-card{
    margin: 10px 0;
  }
  .el-card__header{
    padding: 0 10px;
    text-align: left;
    font-size: 14px;
    line-height: 30px;
    line-height: 30px;
  }
}
</style>
